package edu.tju.dorm;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;



public class IbatisStudentInfoDao implements IStudentInfoDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();


	@Override
	public void deleteStudentInfo(long id) throws SQLException {
		sqlMap.delete("deleteDorm", id);
		
	}

	@Override
	public List<StudentInfo> getStudentInfoAnd(StudentInfo studentInfo)
			throws SQLException {
		return  sqlMap.queryForList("getStudentInfoAnd", studentInfo);
	}

	@Override
	public StudentInfo getStudentInfoById(long id) throws SQLException {
		return (StudentInfo) sqlMap.queryForObject("getStudentInfoById", id);
	}

	@Override
	public List<StudentInfo> getStudentInfoOr(StudentInfo studentInfo)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public Long insertStudentInfo(StudentInfo studentInfo) throws SQLException {
		return (Long)sqlMap.insert("insertStudentInfo", studentInfo); 
	}

	@Override
	public int updateStudentInfo(StudentInfo studentInfo) throws SQLException {
		return sqlMap.update("updateStudentInfo", studentInfo);
	}

}
